//
//  YZdetailView.m
//  FastDoctor
//
//  Created by yongzhen on 16/9/8.
//  Copyright © 2016年 yongzhen. All rights reserved.
//

#import "YZdetailView.h"
#import "Masonry.h"

@implementation YZdetailView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
         self.backgroundColor = [UIColor whiteColor];
        [self setupUI];
    }
    return self;
}

-(void)DetailViewWithString:(NSString *)imagestring nameString:(NSString *)nameString jobString:(NSString *)jobString;
{
    
    _imageV.image = [UIImage imageNamed:imagestring];
    _nameLabel.text = nameString;
    _jobLabel.text = [NSString stringWithFormat:@"%@医师",jobString];
    
    
}





-(void)setupUI
{
    // 设置照片
    UIImageView *imageV = [[UIImageView alloc] init];
    
    [self addSubview:imageV];
    [imageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(self).offset(8);
        make.width.equalTo(@60);
        make.height.equalTo(@60);
        
    }];
    imageV.layer.cornerRadius = 30;
    imageV.layer.masksToBounds = YES;
    
    // 设置医生姓名label
    UILabel *nameLabel = [[UILabel alloc] init];
    nameLabel.tintColor = [UIColor blackColor];
    nameLabel.text = @"王医生";
    [nameLabel sizeToFit];
    [self addSubview:nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(imageV);
        make.left.mas_equalTo(imageV.mas_right).offset(20);
    }];
    
    //医生职位
    UILabel *jobLabel = [[UILabel alloc] init];
    jobLabel.textColor = [UIColor grayColor];
    jobLabel.text = [NSString stringWithFormat:@"%@医师",_jobLabel.text];
    jobLabel.font = [UIFont systemFontOfSize:15];
    [jobLabel sizeToFit];
    [self addSubview:jobLabel];
    [jobLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(imageV);
        make.left.mas_equalTo(nameLabel.mas_right).offset(20);
    }];

    // 医院介绍
    
    UILabel *WorkLabel = [[UILabel alloc] init];
    WorkLabel.textColor = [UIColor grayColor];
    WorkLabel.text = @"北京协和医院-心血管内科";
    WorkLabel.font = [UIFont systemFontOfSize:15];
    [WorkLabel sizeToFit];
    [self addSubview:WorkLabel];
    [WorkLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(imageV);
        make.left.mas_equalTo(nameLabel);
    }];
    
    // 称号
    UIButton *teacherBtn = [[UIButton alloc] init];

    [teacherBtn setTitle:@"导师" forState:UIControlStateNormal];

    [teacherBtn setTitleColor:[UIColor colorWithRed:0 green:0 blue:(float)180/255 alpha:1] forState:UIControlStateNormal];
    teacherBtn.backgroundColor = [UIColor whiteColor];
    teacherBtn.titleLabel.font = [UIFont systemFontOfSize:17];
    [teacherBtn sizeToFit];
    [self addSubview:teacherBtn];
    [teacherBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(imageV);
        make.top.mas_equalTo(imageV.mas_bottom).offset(8);
      
        
    }];
    // 职称
    UIButton *positionBtn = [[UIButton alloc] init];
    
    [positionBtn setTitle:@"王教授" forState:UIControlStateNormal];
    
    [positionBtn setTitleColor:[UIColor colorWithRed:0 green:0 blue:(float)180/255 alpha:1] forState:UIControlStateNormal];
    positionBtn.backgroundColor = [UIColor whiteColor];
    positionBtn.titleLabel.font = [UIFont systemFontOfSize:17];
    [positionBtn sizeToFit];
    [self addSubview:positionBtn];
    [positionBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(teacherBtn.mas_right).offset(18);
        make.top.mas_equalTo(imageV.mas_bottom).offset(8);
}];
    
    // 噱头
    // 职称
    UIButton *chinaxxBtn = [[UIButton alloc] init];
    
    [chinaxxBtn setTitle:@"中国肿瘤医学委员会医师" forState:UIControlStateNormal];
    
    [chinaxxBtn setTitleColor:[UIColor colorWithRed:0 green:0 blue:(float)180/255 alpha:1] forState:UIControlStateNormal];
    chinaxxBtn.backgroundColor = [UIColor whiteColor];
    chinaxxBtn.titleLabel.font = [UIFont systemFontOfSize:17];
    [chinaxxBtn sizeToFit];
    [self addSubview:chinaxxBtn];
    [chinaxxBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(positionBtn.mas_right).offset(18);
        make.top.mas_equalTo(imageV.mas_bottom).offset(8);
        
        
    }];
    
//    UIButton *likeBtn = [[UIButton alloc]init];
//    [likeBtn setBackgroundImage:[UIImage imageNamed:@"五角星.png"] forState: UIControlStateNormal];
//    [likeBtn setBackgroundImage:[UIImage imageNamed:@"五角星黄色填充.png"] forState:UIControlStateSelected];
//    self.drLikeBtn = likeBtn;
//    [self addSubview:likeBtn];
//    [likeBtn sizeToFit];
////    likeBtn.frame = CGRectMake(0, 0, 28, 27);
//    [likeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.right.mas_equalTo(self).offset(-20);
//        make.width.mas_equalTo(28);
//        make.height.mas_equalTo(27);
//        make.top.equalTo(self).offset(20);
//    }];
//
//    
//    [_drLikeBtn addTarget:self action:@selector(likeBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    
    
    _imageV = imageV;
    _nameLabel = nameLabel;
    _jobLabel = jobLabel;
    _WorkLabel = WorkLabel;
}
-(void)likeBtnClick:(UIButton *)Btn
{
    
}
@end
